package com.cq.hd.member.controller;

import com.cq.hd.common.response.Result;
import com.cq.hd.common.response.ResultGenerator;
import com.cq.hd.member.api.TbWxSubscribeRecordApi;
import com.cq.hd.member.api.dto.WxSubscribeRecordSaveDto;
import com.cq.hd.member.api.vo.WxSubscribeRecordVo;
import com.cq.hd.member.service.TbWxSubscribeRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 用户关注公众号记录表 前端控制器
 * </p>
 *
 * @author mYunYu
 * @since 2024-02-26
 */
@RestController
public class TbWxSubscribeRecordController implements TbWxSubscribeRecordApi {

    @Autowired
    private TbWxSubscribeRecordService wxSubscribeRecordService;

    @Override
    public Result<Boolean> saveWxSubscribeRecord(@RequestBody WxSubscribeRecordSaveDto wxSubscribeRecordSaveDto) {
        return ResultGenerator.success(wxSubscribeRecordService.saveWxSubscribeRecord(wxSubscribeRecordSaveDto));
    }

    @Override
    public Result<Boolean> delByOpenId(String openid) {
        return ResultGenerator.success(wxSubscribeRecordService.delByOpenId(openid));
    }

    @Override
    public Result<WxSubscribeRecordVo> getByUserId(Long userId) {
        return ResultGenerator.success(wxSubscribeRecordService.getByUserId(userId));
    }
}
